﻿namespace Zove.Runtime.Queries
{
    /// <summary>
    /// Query result
    /// </summary>
    public class QueryResult
    {
        public QueryResult(string item, string value, string unit, string solution)
        {
            Item = item;
            Value = value;
            Expression = solution;
            Unit = unit;
        }

        /// <summary>
        /// Item
        /// </summary>
        public string Item { get; set; }

        /// <summary>
        /// Value
        /// </summary>
        public string Value { get; set; }

        /// <summary>
        /// Expression
        /// </summary>
        public string Expression { get; set; }

        /// <summary>
        /// Unit
        /// </summary>
        public string Unit { get; set; }

        public override string ToString()
        {
            return
                string.IsNullOrEmpty(Unit)
                    ? string.Format("{0} = {1}", Item, Value)
                    : string.Format("{0} = {1} {2}", Item, Value, Unit);
        }
    }
}